package com.tinysand.advert.entity.condition;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

/**
 * 广告与推广单元的关系对应实体类
 *
 * Created By TINY
 * Create Time 2020/2/15
 **/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "creative_unit")
@EntityListeners(AuditingEntityListener.class) // 使用JPA审计自动维护日期
public class AdvertUnitRelation {

    /* 广告与推广单元关系表自增主键 */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id", nullable = false)
    private Long id;

    /* 广告id */
    @Column(name = "creative_id", nullable = false)
    private Long creativeId;

    /* 推广单元id */
    @Column(name = "unit_id", nullable = false)
    private Long unitId;

    public AdvertUnitRelation(Long creativeId, Long unitId) {
        this.creativeId = creativeId;
        this.unitId = unitId;
    }
}
